#define _CRT_SECURE_NO_WARNINGS 1
//#include <iostream>
//#include <string>
//#include <functional>
//#include <algorithm>
//#include <vector>
//using namespace std;
//
//#include"vector.h"
//
//int main()
//{
//	bit::test_vector7();
//	return 0;
//}

#include <stdio.h>

int main() {
    int x = 0;
    scanf("%d", &x);
    int count = 0;
    for (int i = 0; i <= x; i++)
    {
        int num = i * i;
        num %= 10;
        if (num == (i%10))
        {
            count++;
        }
    }
    printf("%d", count);
    return 0;
}